import { CommonResponse } from '../types';
import * as moment from 'moment';
// 对响应体的封装
export function responseWrapper(data: any, isFail?: boolean): CommonResponse {
  return {
    code: isFail ? 1 : 0,
    data: data,
    message: !isFail ? '成功' : data.message ? data.message : '失败',
  };
}

export function formatDate(timestamp: number) {
  return moment(timestamp).format('YYYY-MM-DD HH:mm:ss');
}
